<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Running Ibator From a Command Prompt</title>
  <link type="text/css" rel="stylesheet" href="../ibator.css"/>
</head>
<body>

<div class="menuNav">
  <p>
    <a href="../index.html" target="_top">Show Menu</a>
    <a href="runningFromCmdLine.html" target="_top">Hide Menu</a>
  </p>
</div>

<h1>Running Ibator From a Command Prompt</h1>
<p>Ibator may be run directly from a command prompt.  The JAR manifest includes the
   name of the default class (<code>org.apache.ibatis.ibator.api.IbatorRunner</code>)
   or you may specify it yourself.  The <code>IbatorRunner</code>
   class accepts several arguments as detailed below:</p>
<table border="1" cellspacing="0" cellpadding="5">
<tr>
  <th>Argument</th>
  <th>Value</th>
</tr>
<tr>
  <td>-configfile <i>file_name</i> <br/>(required)</td>
  <td>Specifies the name of the configuration file.</td>
</tr>
<tr>
  <td>-overwrite (optional)</td>
  <td>If specified, then existing Java files will be overwritten if an existing Java
      file if found with the same name as a generated file.  If not specified, and a
      Java file already exists with the same name as a generated file, then Ibator
      will write the newly generated Java file to the proper directory with a
      unique name (e.g. MyClass.java.1, MyClass.java.2, etc.).
      <b>Important: Ibator will always merge and overwrite XML files.</b></td>
</tr>
<tr>
  <td>-verbose (optional)</td>
  <td>If specified, then Ibator will write progress messages to the console.</td>
</tr>
<tr>
  <td>-forceJavaLogging (optional)</td>
  <td>If specified, then Ibator will use Java logging rather than Log4J even if
      Log4J is in the runtime classpath.</td>
</tr>
<tr>
  <td>-contextids <i>context1,context2,...</i><br/>(optional)</td>
  <td>If specified, then this is a comma delimited list of contexts to use in
      the current run of Ibator.  Any id specified in the list must exactly
      match the value of the <code>id</code> attribute of an
      &lt;ibatorContext&gt; configuration element.  Only ids specified
      in this list will be active for this run of Ibator.  If this argument
      is not specified, then all contexts will be active.</td>
</tr>
<tr>
  <td>-tables <i>table1, table2,...</i><br/>(optional)</td>
  <td>If specified, then this is a comma delimited list of tables to use in
      the current run of Ibator.  Any table specified in the list must exactly
      match the fully qualified table name specified in a
      &lt;table&gt; configuration element.  Only tables specified
      in this list will be active for this run of Ibator.  If this argument
      is not specified, then all tables will be active.
      Specify table names as: <br/><br/>
      <code>table</code><br/>
      <code>schema.table</code><br/>
      <code>catalog..table</code><br/>
      etc.</td>
</tr>
</table>

<p>You must create an Ibator XML configuration file to run Ibator from the
   command line.  If the file is
   named "ibatorConfig.xml", then any of the following command lines will run
   Ibator:</p>
<pre>
   java -jar ibator.jar -configfile ibatorConfig.xml
   java -jar ibator.jar -configfile ibatorConfig.xml -overwrite
   java -cp ibator.jar org.apache.ibatis.ibator.api.IbatorRunner -configfile ibatorConfig.xml
   java -cp ibator.jar org.apache.ibatis.ibator.api.IbatorRunner -configfile ibatorConfig.xml -overwrite
</pre>
</body>
</html>